Visualizing Marine Protected Areas and Biodiversity

2021 team: Lei Ma, Enrique Montes, Liz Sutter, Caroline Cappello, Tasha Gownaris, Ben Tupper, Nick Record 2020 team: Abby Benson, Rene Francolini, Natalie Posdaljian, Natalie Low, Kyle Oliveira, Camille Ross, Sam McNeely, Nick Record, Camille Ross, Angel Segura, Ben Tupper

Purpose

MPA OBIS OBIS is a global open-access data and information clearing-house on marine biodiversity for science, conservation and sustainable development

MPAS Conserved waters for a number of reasons including economic resources, biodiversity conservation, and species protection

IUCN Category The International Union for Conservation of Nature has 7 categoies for classifying protected areas, ranging from “Ia Strict Nature Reserve” to “VI Protected area with sustainable use of natural resources”

Previous year’s accomplishments

Goals for this year

  1. Create an RShiny interface to implement user input for
  • selection and filtering of MPAs
  • query of OBIS records based on selected MPAs
  • display of biodiversity statistics correlating OBIS data with MPAs
  1. Improve the backend functioning

Demo of Shiny interface





Preview of future features: Querying OBIS based on MPA polygons

knitr::opts_chunk$set(echo = TRUE)
library(sf)
## Linking to GEOS 3.9.1, GDAL 3.2.1, PROJ 7.2.0
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✓ ggplot2 3.3.5     ✓ purrr   0.3.4
## ✓ tibble  3.1.3     ✓ dplyr   1.0.7
## ✓ tidyr   1.1.3     ✓ stringr 1.4.0
## ✓ readr   1.4.0     ✓ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
library(reshape2)
## 
## Attaching package: 'reshape2'
## The following object is masked from 'package:tidyr':
## 
##     smiths
library(robis)
library(leaflet)
library(ggplot2)
library(vegan)
## Loading required package: permute
## Loading required package: lattice
## This is vegan 2.5-7
source("R-code/robis-package.R")
## Loading required package: wdpar
## Warning in library(package, lib.loc = lib.loc, character.only = TRUE,
## logical.return = TRUE, : there is no package called 'wdpar'
# robis::occurrence() expect filtering polygons in a well-known-text represerntation (aka WKT)
extract_polygon_geometry <- function(polygon) {
  polygon %>%
    sf::st_geometry() %>%
    sf::st_as_text()
}

get_one_mpa <- function(x, key){
   robis::occurrence(geometry = sf::st_as_text(sf::st_convex_hull(sf::st_geometry(x))))
}

convert_mpa_to_WKT <- function(x){
  st_as_text(st_convex_hull(st_geometry(x)))
}

get_datasets <- function(x){
  get_one_dataset <- function(x, key){
    robis::dataset(geometry=convert_mpa_to_WKT(x))
  }
  x %>% 
    dplyr::rowwise() %>% 
    dplyr::group_map(get_one_dataset, .keep=TRUE) %>% 
    dplyr::bind_rows()
}
# reading in the global MDPA file
# global <- wdpa_read_global(filestream=TRUE)
# saveRDS(global, file="delete_after_ohw21_2.rds")
global <- readRDS("delete_after_ohw21_2.rds")
# subsetting for Belgium
belgium <- global %>% filter(ISO3 %in% "BEL")
# Retrieving all OBIS records for Belgium
# bel_spoc <- read_obis_country("Belgium")
# Getting a subregion's OBIS records
#belgium_sub_obis <- filter(belgium, WDPAID==555536868) %>% get_one_mpa()
#saveRDS(belgium_sub_obis, "delete_after_ohw21.rds")
belgium_sub_obis <- readRDS("delete_after_ohw21.rds")

Belgium’s OBIS data

We chose to use Belgium as an example for this section because it’s very data rich for OBIS. The main OBIS office is in Belgium! In this small area there are over half and million observations. Here’s an example of what the OBIS tables look like:

head(belgium_sub_obis %>% select(scientificName, class, infraclass, genus, eventDate))
## # A tibble: 6 × 5
##   scientificName     class             infraclass genus       eventDate         
##   <chr>              <chr>             <chr>      <chr>       <chr>             
## 1 Nematoda           <NA>              <NA>       <NA>        1998-02           
## 2 Larus canus        Aves              <NA>       Larus       2003-02-28        
## 3 Eteone flava       Polychaeta        <NA>       Eteone      2005-09-29        
## 4 Halichoerus grypus Mammalia          <NA>       Halichoerus 2012-10-28T01:50:…
## 5 Larus argentatus   Aves              <NA>       Larus       2008-05-22        
## 6 Naviculaceae       Bacillariophyceae <NA>       <NA>        2005-04

So, even though Belgium’s MPAs are a small area, for the purposes of this demo, we’re going to only pull OBIS records for the tiny region in the northeast. In the Shiny App, we plan on having the user select MPAs by clicking or filtering by certain parameters such as IUCN category or year established and only pulling OBIS records from those regions.

# plot an example map of Belgium
leafletplot <- leaflet(data=belgium) %>% addProviderTiles(providers$Stamen.Watercolor, options = providerTileOptions(noWrap = TRUE)) %>% addPolygons(popup = ~sprintf("%s", WDPAID))
leafletplot

Here are all the observations from that region

# Visualize OBIS records for this 
belgium_sub <- filter(belgium, WDPAID==555536868)
leaflet() %>%
  addProviderTiles(provider = providers$Stamen.Watercolor) %>%
  addPolygons(data=belgium_sub) %>% 
  addCircleMarkers(lat = belgium_sub_obis$decimalLatitude, lng = belgium_sub_obis$decimalLongitude, radius = 3, weight = 0, fillOpacity = .7, fillColor = "#CC3300")

Biodiversity measurements for this region

Explanation of ES50 measurement*

# remove terrestrial species
species_occurence <- belgium_sub_obis %>% filter(terrestrial==FALSE)

# make species abundance table by year
species_occurence <- species_occurence %>% group_by(date_year, scientificName) %>% summarise(occurences = n())
## `summarise()` has grouped output by 'date_year'. You can override using the `.groups` argument.
species_occurence %>% group_by(date_year) %>% summarise(total_occ = sum(occurences)) %>% ggplot(aes(x=date_year, y=total_occ))+geom_line()+labs(x="Year", y="Total occurences (all species", title="Uneven sampling effort through the years")
## Warning: Removed 1 row(s) containing missing values (geom_path).

ES50 is also sensitive to the total number of species. It’s generally best when there are >50 species

# unique species by year
belgium_sub_obis %>% filter(date_year>1975 & date_year<2018) %>% group_by(date_year) %>% summarise(unqs=length(unique(scientificName))) %>% ggplot(aes(x=date_year, y=unqs))+geom_line()+labs(x="Year", y="Unique species")+geom_hline(yintercept=50)

So, let’s look at ES50 before and after 2010, which is when this region was established as an MPA

year <- belgium_sub$STATUS_YR
species_occurence <- mutate(species_occurence, before=date_year<year)
occurence_matrix_before <- species_occurence %>% filter(before) %>% select(-before) %>% pivot_wider(names_from = date_year, values_from=occurences, names_sort=TRUE, values_fill=0)
occurence_matrix_after <- species_occurence %>% filter(!before) %>% select(-before) %>% pivot_wider(names_from = date_year, values_from=occurences, names_sort=TRUE, values_fill=0)
occurence_matrix <- species_occurence %>% select(-before) %>% pivot_wider(names_from = scientificName, values_from=occurences, names_sort=TRUE, values_fill=0) %>% filter(!is.na(date_year)) %>% column_to_rownames(var="date_year")

es50<-rarefy(occurence_matrix, 50) %>% as_tibble(rownames="date_year")
## Warning in rarefy(occurence_matrix, 50): requested 'sample' was larger than
## smallest site maximum (1)
ggplot(es50 %>% filter(date_year>1975 & date_year<2018), aes(x=as.numeric(date_year), y=value)) + geom_line() + geom_vline(xintercept = year, color="green") + labs(x="Year", y="ES50")

This graph illustrates why the choice of MPA is very important. The MPA needs to be in a data rich region for OBIS records, and needs to have been established long enough ago to see effects.